import { Navigate, Route, Routes } from "react-router-dom"
import HomeView from "../views/home/HomeView"
import NotFound from "../views/NotFound"
import FilmsView from "../views/home/children/films/FilmsView"
import CinemasView from "../views/home/children/cinemas/CinemasView"
import QueryView from "../views/home/children/query/QueryView"
import CenterView from "../views/home/children/center/CenterView"
import RouterEnter from "./RouterEnter"
import { lazy } from "react"
const CityView = lazy(() => import('../views/city/CityView'))
const FilmDetail = lazy(() => import('../views/filmdetail/FilmDetail'))

function RouterView () {

  // #region 变量声明

  // #endregion

  // #region 函数

  // #endregion

  // #region Hooks

  // #endregion

  return (
    <>
      <Routes>
        <Route path="/" element={ <Navigate to="/home" />   } />
        <Route path="/home" element={ <Navigate to="/home/films" />   } />
        <Route path="/home/films" element={ <Navigate to="/home/films/nowPlaying" />   } />
        <Route path="/home/*" element={ <RouterEnter element={ <HomeView /> } /> }>
          <Route path="films/:type" element={ <FilmsView /> } />
          <Route path="cinemas" element={ <CinemasView /> } />
          <Route path="query" element={ <QueryView /> } />
          <Route path="center" element={ <CenterView /> } />
        </Route>
        <Route path="/film/:filmId" element={ <FilmDetail /> } />
        <Route path="/city" element={ <CityView /> } />
        <Route path="*" element={ <RouterEnter element={ <NotFound /> } /> } />
      </Routes>
    </>
  )
}

export default RouterView
